package com.gimi.cloud.bbp.dao.dao.product;

import com.gimi.cloud.bbp.entity.product.ProductStatusEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface ProductStatusDao extends BaseMapper<ProductStatusEntity> {
    int deleteByPrimaryKey(String prodId);

    int insert(ProductStatusEntity record);

    int insertSelective(ProductStatusEntity record);
    
    int getProdStatus(String prodId);

    ProductStatusEntity selectByPrimaryKey(String prodId);

    int updateByPrimaryKeySelective(ProductStatusEntity record);

    int updateByPrimaryKey(ProductStatusEntity record);

    @Update("UPDATE ec_prod_status SET prod_status = 1,prod_update_time = NOW(),prod_putaway_time=NOW(),reason = #{reason},operator_id = #{operatorId} WHERE prod_id = #{prodId};")
    int upShelfProduct(@Param(value = "reason") String reason,@Param(value = "operatorId") String operatorId,@Param(value = "prodId") String prodId);

    @Update("UPDATE ec_prod_status SET prod_status = 2,prod_update_time = NOW(),prod_out_of_stock_time=NOW(),reason = #{reason},operator_id = #{operatorId} WHERE prod_id = #{prodId};")
    int offShelfProduct(@Param(value = "reason") String reason,@Param(value = "operatorId") String operatorId,@Param(value = "prodId") String prodId);
}